<%@ page contentType="text/html;charset=utf-8" %>
<%@ page language="java" import="java.io.*" %>
<%request.setCharacterEncoding("utf-8");%> 
<%@ page pageEncoding="utf-8"%> 
<%
	String docNamePath = request.getParameter("docNamePath");
	String docType = request.getParameter("docType");
	java.io.OutputStream outStream = null;
	java.io.InputStream in = null;
	  try
	  {
		response.reset();
		response.setContentType("application/octet-stream");
		response.setHeader("Content-Disposition", "attachment; filename=");
		outStream = response.getOutputStream(); 
		in = new FileInputStream(docNamePath);
		byte[] buf = new byte[1024];
		int bytes = 0;
		while((bytes = in.read(buf)) != -1)
			outStream.write(buf, 0, bytes); 
		outStream.flush();
	  }
	  catch(Throwable e)
	  {
	  	System.out.println(e.toString());
		throw new ServletException(e.toString());
	  }finally{
        if(in != null)
        {
            in.close();
            in = null;
        }
        if(outStream != null)
        {
            outStream.close();
            outStream = null;
        }
    }
    out.clear();
    out = pageContext.pushBody();
%>